import request from '@/utils/request'

/**
 * 服务名称
 */
const serviceName = '/basedata'

export function login(data) {
  return request({
    url: '/vue-element-admin/user/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: `${serviceName}/account/info`,
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: `${serviceName}/logout`,
    method: 'post'
  })
}

export function page(data) {
  return request({
    url: `${serviceName}/user/page`,
    method: 'get',
    params: data
  })
}

export function create(data) {
  return request({
    url: `${serviceName}/user/create`,
    method: 'post',
    data
  })
}

export function update(data) {
  return request({
    url: `${serviceName}/user/update`,
    method: 'post',
    data
  })
}

export function setStatus(data) {
  return request({
    url: `${serviceName}/user/status`,
    method: 'post',
    data
  })
}

export function resetPwd(data) {
  return request({
    url: `${serviceName}/user/reset/password`,
    method: 'post',
    data
  })
}

export function setUserLeaved(data) {
  return request({
    url: `${serviceName}/user/set/leaved`,
    method: 'post',
    data
  })
}
